pub resolve: &'a Resolve,
pub sources: &'a SourceMap<'b>,
pub compilation: Compilation,
- pub env: &'a str,
+ env: &'a str,
host: Layout,
target: Option<Layout>,
target_triple: String,
.expect("Should have found package")
}
+ pub fn env(&self) -> &str {
+ // The "doc-all" environment just means to document everything (see
+ // below), but we want to canonicalize that the the "doc" profile
+ // environment, so do that here.
+ if self.env == "doc-all" {"doc"} else {self.env}
+ }
+
pub fn is_relevant_target(&self, target: &Target) -> bool {
target.is_lib() && match self.env {
"doc" | "test" | "bench" => target.get_profile().is_compile(),
cx: &Context, first: bool) -> CargoResult<Work> {
let root = cx.get_package(cx.resolve.root());
let profile = root.get_manifest().get_targets().iter()
- .find(|target| target.get_profile().get_env() == cx.env)
+ .find(|target| target.get_profile().get_env() == cx.env())
.map(|target| target.get_profile());
let profile = match profile {
Some(profile) => profile,
- None => return Err(internal(format!("no profile for {}", cx.env)))
+ None => return Err(internal(format!("no profile for {}", cx.env())))
};
// TODO: this needs to be smarter about splitting